import Vue from 'vue'
import Router from 'vue-router'

// 前台组件
import FrontIndex from 'indexIndex/index/index.vue'
import FrontHomePage from 'indexIndex/home-page/home-page.vue'
import FrontAbout from 'indexIndex/about/about.vue'
import ServerProject from 'indexIndex/server-project/server-project'
import CaseShow from 'indexIndex/case-show/case-show'
import CaseShowBefore from 'indexIndex/case-show-before/case-show-before'
import CaseShowAfter from 'indexIndex/case-show-after/case-show-after'
import IndexBids from 'indexIndex/bids/bids'
import ContectUs from 'indexIndex/contect-us/contect-us'
import DynamicInfo from 'indexIndex/dynamic-info/dynamic-info'
import BidDetail from 'indexIndex/bid-detail/bid-detail'
import DynamicDetail from 'indexIndex/dynamicDetail/dynamic-detail'
import TeamDetail from 'indexIndex/team-detail/team-detail'
import WinBids from 'indexIndex/win-bids/win-bids'
import CallBids from 'indexIndex/call-bids/call-bids'
import WinBidsDetail from 'indexIndex/win-bids-detail/win-bids-detail'
import TeamConference from 'indexIndex/team-detail/team-conference'
import TeamTelephone from 'indexIndex/team-detail/team-telephone'

// 后台组件
import BackendIndex from 'backendIndex/index/index.vue'
import BackendLogin from 'backendIndex/login/login.vue'
import BackendHomePage from 'backendIndex/home-page/home-page.vue'
import MenuContainer from 'backendIndex/menu-container/menu-container'
import Article from 'backendIndex/article/article'
import UploadPicture from 'backendIndex/uploadPicture/uploadPicture'
import PostArticle from 'backendIndex/postArticle/postArticle'
import ArticleDetail from 'backendIndex/articleDetail/articleDetail.vue'
import Bids from 'backendIndex/bids/bids.vue'
import BidsDetail from 'backendIndex/bids-detail/bids-detail.vue'

// 报错组件
import Err403 from 'backendIndex/err/404.vue'
// import Err404 from 'backendIndex/err/404.vue'

Vue.use(Router)

export default new Router({
  mode: 'history',
  linkActiveClass: 'active',
  routes: [
    {
      path: '/',
      redirect: '/index/home-page'
    },
    {
      path: '/index',
      component: FrontIndex,
      redirect: '/index/home-page',
      children: [
        {
          path: '',
          redirect: '/index/home-page'
        },
        {
          path: 'home-page',
          component: FrontHomePage
        },
        {
          path: 'about',
          component: FrontAbout
        },
        {
          path: 'server',
          component: ServerProject
        },
        {
          path: 'case-show',
          component: CaseShow,
          redirect: 'case-show/case-show-before',
          children: [
            {
              path: 'case-show-before',
              component: CaseShowBefore
            },
            {
              path: 'case-show-after/:zone',
              component: CaseShowAfter
            }
          ]
        },
        {
          path: 'bids',
          component: IndexBids,
          children: [
            {
              path: 'win-bids',
              component: WinBids
            },
            {
              path: 'call-bids',
              component: CallBids
            }
          ]
        },
        {
          path: 'contect-us',
          component: ContectUs
        },
        {
          path: 'dynamic-info/:zone?',
          component: DynamicInfo
        },
        {
          path: 'bid-detail/:id',
          component: BidDetail
        },
        {
          path: 'dynamic-detail/:id',
          component: DynamicDetail
        },
        {
          path: 'team-detail',
          component: TeamDetail
        },
        {
          path: 'win-bids-detail/:id',
          component: WinBidsDetail
        },
        {
          path: 'team-conference',
          component: TeamConference
        },
        {
          path: 'team-telephone',
          component: TeamTelephone
        }
      ]
    },
    {
      path: '*',
      component: Err403
    },
    {
      path: '/backend',
      component: BackendIndex,
      redirect: '/backend/login',
      children: [
        {
          path: 'login',
          component: BackendLogin
        },
        {
          path: 'index',
          component: BackendHomePage,
          redirect: 'index/article',
          children: [
            {
              path: 'menu-container',
              component: MenuContainer
            },
            {
              path: 'article',
              component: Article
            },
            {
              path: 'upload-picture',
              component: UploadPicture
            },
            {
              path: 'post-article/:id?',
              component: PostArticle
            },
            {
              path: 'article-detail/:id',
              component: ArticleDetail
            },
            {
              path: 'bids',
              component: Bids
            },
            {
              path: 'bids-detail',
              component: BidsDetail
            }
          ]
        },
        {
          path: '*',
          component: BackendLogin
        }
      ]

    }

  ]
})
